﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharpExperiments
{
	public static class IVector
	{
		public static IVector1<T> Create<T>(T a) { return new IVector1<T>(a); }
		public static IVector2<T> Create<T>(T a, T b) { return new IVector2<T>(a, b); }
		public static IVector3<T> Create<T>(T a, T b, T c) { return new IVector3<T>(a, b, c); }
		public static IVector4<T> Create<T>(T a, T b, T c, T d) { return new IVector4<T>(a, b, c, d); }
	}

	public class IVector1<T>
	{
		private T a;

		internal IVector1(T a)
		{
			this.a = a;
		}
	}

	public class IVector2<T>
	{
		private T a;
		private T b;

		internal IVector2(T a, T b)
		{
			this.a = a;
			this.b = b;
		}

		public static implicit operator IVector1<T>(IVector2<T> vec)
		{
			return new IVector1<T>(vec.a);
		}
	}

	public class IVector3<T>
	{
		private T a;
		private T b;
		private T c;
		
		internal IVector3(T a, T b, T c)
		{
			this.a = a;
			this.b = b;
			this.c = c;
		}

		public static implicit operator IVector1<T>(IVector3<T> vec)
		{
			return new IVector1<T>(vec.a);
		}

		public static implicit operator IVector2<T>(IVector3<T> vec)
		{
			return new IVector2<T>(vec.a, vec.b);
		}
	}

	public class IVector4<T>
	{
		private T a;
		private T b;
		private T c;
		private T d;
		
		internal IVector4(T a, T b, T c, T d)
		{
			this.a = a;
			this.b = b;
			this.c = c;
			this.d = d;
		}

		public static implicit operator IVector1<T>(IVector4<T> vec)
		{
			return new IVector1<T>(vec.a);
		}

		public static implicit operator IVector2<T>(IVector4<T> vec)
		{
			return new IVector2<T>(vec.a, vec.b);
		}

		public static implicit operator IVector3<T>(IVector4<T> vec)
		{
			return new IVector3<T>(vec.a, vec.b, vec.c);
		}
	}
}
